package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.StatisticsRevenueStats;
import com.ruoyi.system.service.IStatisticsRevenueStatsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 存放内容创作者的收益统计数据
Controller
 * 
 * @author ruoyi
 * @date 2024-08-15
 */
@RestController
@RequestMapping("/system/revenue")
public class StatisticsRevenueStatsController extends BaseController
{
    @Autowired
    private IStatisticsRevenueStatsService statisticsRevenueStatsService;

    /**
     * 查询存放内容创作者的收益统计数据
列表
     */
    @PreAuthorize("@ss.hasPermi('system:revenue:list')")
    @GetMapping("/list")
    public TableDataInfo list(StatisticsRevenueStats statisticsRevenueStats)
    {
        startPage();
        List<StatisticsRevenueStats> list = statisticsRevenueStatsService.selectStatisticsRevenueStatsList(statisticsRevenueStats);
        return getDataTable(list);
    }

    /**
     * 导出存放内容创作者的收益统计数据
列表
     */
    @PreAuthorize("@ss.hasPermi('system:revenue:export')")
    @Log(title = "存放内容创作者的收益统计数据 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, StatisticsRevenueStats statisticsRevenueStats)
    {
        List<StatisticsRevenueStats> list = statisticsRevenueStatsService.selectStatisticsRevenueStatsList(statisticsRevenueStats);
        ExcelUtil<StatisticsRevenueStats> util = new ExcelUtil<StatisticsRevenueStats>(StatisticsRevenueStats.class);
        util.exportExcel(response, list, "存放内容创作者的收益统计数据数据");
    }

    /**
     * 获取存放内容创作者的收益统计数据
详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:revenue:query')")
    @GetMapping(value = "/{revenueId}")
    public AjaxResult getInfo(@PathVariable("revenueId") Long revenueId)
    {
        return success(statisticsRevenueStatsService.selectStatisticsRevenueStatsByRevenueId(revenueId));
    }

    /**
     * 新增存放内容创作者的收益统计数据

     */
    @PreAuthorize("@ss.hasPermi('system:revenue:add')")
    @Log(title = "存放内容创作者的收益统计数据 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StatisticsRevenueStats statisticsRevenueStats)
    {
        return toAjax(statisticsRevenueStatsService.insertStatisticsRevenueStats(statisticsRevenueStats));
    }

    /**
     * 修改存放内容创作者的收益统计数据

     */
    @PreAuthorize("@ss.hasPermi('system:revenue:edit')")
    @Log(title = "存放内容创作者的收益统计数据 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StatisticsRevenueStats statisticsRevenueStats)
    {
        return toAjax(statisticsRevenueStatsService.updateStatisticsRevenueStats(statisticsRevenueStats));
    }

    /**
     * 删除存放内容创作者的收益统计数据

     */
    @PreAuthorize("@ss.hasPermi('system:revenue:remove')")
    @Log(title = "存放内容创作者的收益统计数据 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{revenueIds}")
    public AjaxResult remove(@PathVariable Long[] revenueIds)
    {
        return toAjax(statisticsRevenueStatsService.deleteStatisticsRevenueStatsByRevenueIds(revenueIds));
    }
}
